function [Xdynamic_staticInputs] = permute_Xparts_static_X_X_FEs(Xdynamic_staticInputs, dims)
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	% This function preprocesses the inputs Xdynamic_staticInputs by permuting the dimensions,
	% to speed up the computation of the parts of utility that that depend on installedBases.
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	%%%%% Inputs:
	% Xdynamic_staticInputs:			object:
	%	.providerAdoptions:					object:
	%		.Xparts_static:						cell(NumParts, 1):
	%			{1}:								object:
	%				.X:									(T*K) x NumXstatic
	%				.X_FEs:								(T*K) x NumX_FEs
	%		.extraArgs:							cell
	%			{1}:								(T*K) x 1
	%	.consumerAdoptions:					object:
	%		.Xparts_static:						cell(NumParts, 1):
	%			{2}:								object:
	%				.X:									(T*K1) x NumXstatic
	%				.X_FEs:								(T*K1) x NumX_FEs
	%			{3}:								object:
	%				.X:									(T*K2) x NumXstatic
	%				.X_FEs:								(T*K2) x NumX_FEs
	%		.extraArgs:							cell
	%			{1}:								(T*K) x 1
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	%%%%% Outputs:
	% dims:								object
	%	.T:									integer
	%	.K:									integer
	%	.K1:								integer
	%	.K2:								integer
	%
	% Xdynamic_staticInputs:			object:
	%	.consumerAdoptions:					object:
	%		.Xparts_static:						cell(NumParts, 1):
	%			{2}:								object:
	%				.X:									K1 x NumXstatic x T
	%				.X_FEs:								K1 x NumX_FEs x T
	%			{3}:								object:
	%				.X:									K2 x NumXstatic x T
	%				.X_FEs:								K2 x NumX_FEs x T
	%		.extraArgs:							cell
	%			{1}:								K x T
	%	.providerAdoptions:					object:
	%		.Xparts_static:						cell(NumParts, 1):
	%			{1}:								object:
	%				.X:									K x NumXstatic x T
	%				.X_FEs:								K x NumX_FEs x T
	%		.extraArgs:							cell
	%			{1}:								K x T
	%	.providerExits:						object:
	%		.Xparts_static:						cell(NumParts, 1):
	%			{1}:								object:
	%				.X:									K x NumXstatic x T
	%				.X_FEs:								K x NumX_FEs x T
	%		.extraArgs:							cell
	%			{1}:								K x T
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	
	% Read dimensions
	T  = dims.T;
	K  = dims.K;
	K1 = dims.K1;
	K2 = dims.K2;
	
	%%% Xdynamic_staticInputs.providerAdoptions
	myX = Xdynamic_staticInputs.providerAdoptions.Xparts_static{1}.X; % (T*K) x NumXstatic
	myX = reshape(myX, [T K size(myX,2)]);   % T x K x NumXstatic
	myX = permute(myX, [2 3 1]);             % K x NumXstatic x T
	Xdynamic_staticInputs.providerAdoptions.Xparts_static{1}.X = myX;
	clear myX;
	
	myX_FEs = Xdynamic_staticInputs.providerAdoptions.Xparts_static{1}.X_FEs;     % (T*K) x NumX_FEs
	myX_FEs = reshape(myX_FEs, [T K size(myX_FEs,2)]);   % T x K x NumX_FEs
	myX_FEs = permute(myX_FEs, [2 3 1]);                 % K x NumX_FEs x T
	Xdynamic_staticInputs.providerAdoptions.Xparts_static{1}.X_FEs = myX_FEs;
	
	myExtraArgs = Xdynamic_staticInputs.providerAdoptions.extraArgs;
	if ~isempty(myExtraArgs)
		myExtraArg1 = reshape(myExtraArgs{1}, [T K])'; % K x T
		Xdynamic_staticInputs.providerAdoptions.extraArgs{1} = myExtraArg1;
	end
	
	clear myX_FEs;
	
	%%% Xdynamic_staticInputs.providerExits
	myX = Xdynamic_staticInputs.providerExits.Xparts_static{1}.X; % (T*K) x NumXstatic
	myX = reshape(myX, [T K size(myX,2)]);   % T x K x NumXstatic
	myX = permute(myX, [2 3 1]);             % K x NumXstatic x T
	Xdynamic_staticInputs.providerExits.Xparts_static{1}.X = myX;
	clear myX;
	
	myX_FEs = Xdynamic_staticInputs.providerExits.Xparts_static{1}.X_FEs;     % (T*K) x NumX_FEs
	myX_FEs = reshape(myX_FEs, [T K size(myX_FEs,2)]);   % T x K x NumX_FEs
	myX_FEs = permute(myX_FEs, [2 3 1]);                 % K x NumX_FEs x T
	Xdynamic_staticInputs.providerExits.Xparts_static{1}.X_FEs = myX_FEs;
	
	myExtraArgs = Xdynamic_staticInputs.providerExits.extraArgs;
	if ~isempty(myExtraArgs)
		myExtraArg1 = reshape(myExtraArgs{1}, [T K])'; % K x T
		Xdynamic_staticInputs.providerExits.extraArgs{1} = myExtraArg1;
	end
	clear myX_FEs;
	
	
	myX = Xdynamic_staticInputs.consumerAdoptions.Xparts_static{2}.X;		  % (T*K1) x NumXstatic
	myX = reshape(myX, [T K1 size(myX,2)]);    		  % T x K1 x NumXstatic
	myX = permute(myX, [2 3 1]);              		  % K1 x NumXstatic x T
	Xdynamic_staticInputs.consumerAdoptions.Xparts_static{2}.X = myX;
	clear myX;
	
	myX_FEs = Xdynamic_staticInputs.consumerAdoptions.Xparts_static{2}.X_FEs;  % (T*K1) x NumX_FEs
	myX_FEs = reshape(myX_FEs, [T K size(myX_FEs,2)]); % T x K1 x NumX_FEs
	myX_FEs = permute(myX_FEs, [2 3 1]);               % K1 x NumX_FEs x T
	Xdynamic_staticInputs.consumerAdoptions.Xparts_static{2}.X_FEs = myX_FEs;
	clear myX_FEs;
	
	
	myX = Xdynamic_staticInputs.consumerAdoptions.Xparts_static{3}.X;		% (T*K2) x NumXstatic
	myX = reshape(myX, [T K size(myX,2)]); 				% T x K2 x NumXstatic
	myX = permute(myX, [2 3 1]);						% K2 x NumXstatic x T
	Xdynamic_staticInputs.consumerAdoptions.Xparts_static{3}.X = myX;
	clear myX;
	
	myX_FEs = Xdynamic_staticInputs.consumerAdoptions.Xparts_static{3}.X_FEs;  % (T*K2) x NumX_FEs
	myX_FEs = reshape(myX_FEs, [T K size(myX_FEs,2)]); % T x K2 x NumX_FEs
	myX_FEs = permute(myX_FEs, [2 3 1]);               % K2 x NumX_FEs x T
	Xdynamic_staticInputs.consumerAdoptions.Xparts_static{3}.X_FEs = myX_FEs;
	clear myX_FEs;

	
	myExtraArgs = Xdynamic_staticInputs.consumerAdoptions.extraArgs;
	if ~isempty(myExtraArgs)
		myExtraArg1 = reshape(myExtraArgs{1}, [T K])'; % K x T
		Xdynamic_staticInputs.consumerAdoptions.extraArgs{1} = myExtraArg1;
	end
end
